﻿@{
    ViewBag.Title = "Resultado de busqueda";

    Layout = (ViewBag.esCliente != null && ViewBag.esCliente ? "~/Views/Shared/_ClienteLayout.cshtml" : "~/Views/Shared/_Layout.cshtml");
}
@using equinoxWeb.Models;
@using equinoxWeb.GestionConexion;

<!-- content -->

<fieldset style="width: inherit">
    <legend>Casos</legend>
</fieldset>
<script src="/Scripts/caso.js"></script>
<table class="table table-hover">
    <tr>
        <th>@(ViewBag.lang==null || ViewBag.lang == "ES" ? "Referencia":"Code")</th>
        <th style="width: 30%">@(ViewBag.lang==null || ViewBag.lang == "ES" ? "Contenido":"Abstract")</th>
        <th>@(ViewBag.lang==null || ViewBag.lang == "ES" ? "Cliente":"Client")</th>
        <th>@(ViewBag.lang==null || ViewBag.lang == "ES" ? "Fecha inicio":"Starting date")</th>
        <th>@(ViewBag.lang==null || ViewBag.lang == "ES" ? "Fecha fin programada":"Scheduled ending date")</th>
        <th>@(ViewBag.lang==null || ViewBag.lang == "ES" ? "Responsable":"Person in charge")</th>
        <th>@(ViewBag.lang==null || ViewBag.lang == "ES" ? "Tipo de caso":"Scope")</th>
        <th>@(ViewBag.lang==null || ViewBag.lang == "ES" ? "Estado" : "Status")</th>
        
    </tr>
    @foreach (Caso caso in ViewBag.casoResults)
    {
        <tr>
            <td>@CasoFunction.obtenerReferencia(caso.IdCaso)</td>
            <td>@caso.Content </td>
            <td>@caso.Cliente.RazonSocial </td>
            <td>@caso.FechaInicio </td>
            <td>@caso.FechaFin</td>
            <td>@(caso.Usuario.Nombre + " " + caso.Usuario.ApellidoPat)</td>
            <td>@caso.TipoCaso.Descripcion </td>
            <td>@caso.EstadoCaso.Descripcion </td>
            <td><a href="/caso/details?idCaso=@caso.IdCaso"><span title="Ver caso" alt="Ver caso" class="glyphicon glyphicon-search"></span></a></td>
            @if (!ViewBag.esCliente)
            {
                <td><a href="/tarea/ListarTareasCaso?idCaso=@caso.IdCaso"><span title="Ver tareas" alt="Ver tareas" class="glyphicon glyphicon-list"></span></a></td>
            }
        </tr>
    }
</table>
<form name="searchResultsForm" method="get">
    <div class="form-group">
        <div class="col-md-3 col-sm-6">
            @if (!ViewBag.esCliente)
            {
                <button type="button" onclick="javascript:AgregarCaso(document.searchResultsForm)" class="btn btn-large btn-primary">Añadir</button> 
            }
            <button type="button" class="btn btn-large" onclick="javascript:history.back();">@(ViewBag.lang==null || ViewBag.lang == "ES" ? "Atras":"Back")</button>
        </div>
    </div>
</form>

